<html>
  <head><title>SP Objects</title>
    <script src="codepress/codepress.js" type="text/javascript"></script> 
    <link rel="stylesheet" href="style.css" type="text/css" media="all" />
  </head>
  <body>

    <h1>Procedure Object: F_QT_CAN_CROSS_BOR.SQL</h1>
    <p><b>Author:</b> </p>
    <p><b>Date:</b> </p>
    <p><b>Abstract:</b></p>
    <p></b></p>
    <p><b>Sample Calls:</b></p>
    <p>    values(EBIZ1.F_QT_CAN_CROSS_BOR(CHAR('USA'),CHAR(''),CHAR('BRA'),CHAR(''), CHAR('FCT')))<br>  Return<br>    0 : can NOT Cross-border<br>    1 : can Cross-border<br>  </b></p>
    <p></p>
    
    
    
    
    
    
    <h3>Functions:</h3>
    <ul>
      
        <li><b><a href="F_QT_CNTRY_2_RGN.html">EBIZ1.F_QT_CNTRY_2_RGN</a></b></li>
      
        <li><b>F_PRC_CNTRY_SLSINF</b></li>
      
    </ul>
    
    
    
    
    <h3>Source code:</h3>
    <div id="SQLsrc" >
<em>DROP</em>&nbsp;SPECIFIC&nbsp;<b>FUNCTION</b>&nbsp;EBIZ1.F_QT_CAN_CROSS_BOR<br />@<br /><em>CREATE</em>&nbsp;<b>FUNCTION</b>&nbsp;EBIZ1.F_QT_CAN_CROSS_BOR(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;piCntryCodeA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(3),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;piSalesOrgCodeA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(4),&nbsp;<i>--&nbsp;optional,&nbsp;<b>if</b>&nbsp;you&nbsp;don<s>'t&nbsp;know&nbsp;its&nbsp;<b>value</b>&nbsp;,&nbsp;passing&nbsp;'</s>'</i><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;piCntryCodeB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(3),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;piSalesOrgCodeB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(4),&nbsp;<i>--&nbsp;optional,&nbsp;<b>if</b>&nbsp;you&nbsp;don<s>'t&nbsp;know&nbsp;its&nbsp;<b>value</b>&nbsp;,&nbsp;passing&nbsp;'</s>'</i><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;piLob&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(3)<br />)&nbsp;<b>RETURNS</b>&nbsp;<u>SMALLINT</u><br />&nbsp;&nbsp;&nbsp;&nbsp;SPECIFIC&nbsp;EBIZ1.F_QT_CAN_CROSS_BOR<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>LANGUAGE</b>&nbsp;<b>SQL</b><br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NOT</b>&nbsp;DETERMINISTIC<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NO</b>&nbsp;EXTERNAL&nbsp;ACTION<br />&nbsp;&nbsp;&nbsp;&nbsp;READS&nbsp;<b>SQL</b>&nbsp;DATA<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>NULL</b>&nbsp;CALL<br />&nbsp;&nbsp;&nbsp;&nbsp;INHERIT&nbsp;SPECIAL&nbsp;REGISTERS<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><i>-----------------------------------------------------------------------------------</i><br /><i>--&nbsp;&nbsp;<b>Function</b>&nbsp;Name:&nbsp;F_QT_CAN_CROSS_BOR</i><br /><i>--&nbsp;&nbsp;File&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;F_QT_CAN_CROSS_BOR.<b>SQL</b></i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;Will&nbsp;Chang</i><br /><i>--&nbsp;&nbsp;<u>Date</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;01/25/2008</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Abstract</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;Checks&nbsp;<b>if</b>&nbsp;can&nbsp;Cross-border.</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Sample&nbsp;Calls:</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;<b>values</b>(EBIZ1.F_QT_CAN_CROSS_BOR(<u>CHAR</u>(<s>'USA'</s>),<u>CHAR</u>(<s>''</s>),<u>CHAR</u>(<s>'BRA'</s>),<u>CHAR</u>(<s>''</s>),&nbsp;<u>CHAR</u>(<s>'FCT'</s>)))</i><br /><i>--&nbsp;&nbsp;<b>Return</b></i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;:&nbsp;can&nbsp;<b>NOT</b>&nbsp;Cross-border</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;:&nbsp;can&nbsp;Cross-border</i><br /><i>--</i><br /><i>--&nbsp;&nbsp;Maintenance&nbsp;Log</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;who&nbsp;&nbsp;<u>date</u>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><em>comment</em></b></i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;---&nbsp;&nbsp;--------&nbsp;&nbsp;---------------------------------------------------------------</i><br /><i>--&nbsp;&nbsp;&nbsp;&nbsp;Will&nbsp;&nbsp;01/25/08&nbsp;&nbsp;initial&nbsp;version</i><br /><i>-----------------------------------------------------------------------------------</i><br />&nbsp;&nbsp;&nbsp;<em>BEGIN</em>&nbsp;ATOMIC<br />&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;<em>DECLARE</em>&nbsp;vRgnCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(8)&nbsp;<b>default</b>&nbsp;<s>''</s>;<br />&nbsp;&nbsp;&nbsp;<em>DECLARE</em>&nbsp;vReturnFlag&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>SMALLINT</u>&nbsp;<b>default</b>&nbsp;0;<br />&nbsp;&nbsp;&nbsp;<em>DECLARE</em>&nbsp;vSalesOrgCodeA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(4);<br />&nbsp;&nbsp;&nbsp;<em>DECLARE</em>&nbsp;vSalesOrgCodeB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>CHAR</u>(4);<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vRgnCode&nbsp;=&nbsp;EBIZ1.F_QT_CNTRY_2_RGN(piCntryCodeA);<br />&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vSalesOrgCodeA&nbsp;=&nbsp;piSalesOrgCodeA;<br />&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vSalesOrgCodeB&nbsp;=&nbsp;piSalesOrgCodeB;<br />&nbsp;&nbsp;&nbsp;<b>IF</b>&nbsp;(vRgnCode&nbsp;=&nbsp;<s>'APAC'</s>)&nbsp;<b>THEN</b>&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>IF</b>&nbsp;(piCntryCodeA&nbsp;=&nbsp;piCntryCodeB&nbsp;)&nbsp;<b>THEN</b>&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vReturnFlag&nbsp;=&nbsp;1;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>END</em>&nbsp;<b>IF</b>;<br />&nbsp;&nbsp;&nbsp;<b>ELSE</b><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>IF</b>&nbsp;(vSalesOrgCodeB&nbsp;=&nbsp;<s>''</s>)&nbsp;<b>THEN</b><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vSalesOrgCodeA&nbsp;=&nbsp;(<em>SELECT</em>&nbsp;POSALESORGCODE&nbsp;<br />						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b>&nbsp;&nbsp;&nbsp;<b>table</b>(ebiz1.F_PRC_CNTRY_SLSINF&nbsp;(piCntryCodeA&nbsp;,&nbsp;piLob&nbsp;))&nbsp;a<br />						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>FETCH</em>&nbsp;FIRST&nbsp;<b>ROW</b>&nbsp;<b>ONLY</b>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>END</em>&nbsp;<b>IF</b>;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>IF</b>&nbsp;(vSalesOrgCodeB&nbsp;=&nbsp;<s>''</s>)&nbsp;<b>THEN</b><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vSalesOrgCodeB&nbsp;=&nbsp;(<em>SELECT</em>&nbsp;POSALESORGCODE&nbsp;<br />						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b>&nbsp;&nbsp;&nbsp;<b>table</b>(ebiz1.F_PRC_CNTRY_SLSINF&nbsp;(piCntryCodeB&nbsp;,&nbsp;piLob&nbsp;))&nbsp;a<br />						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>FETCH</em>&nbsp;FIRST&nbsp;<b>ROW</b>&nbsp;<b>ONLY</b>);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>END</em>&nbsp;<b>IF</b>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>IF</b>&nbsp;(vSalesOrgCodeA&nbsp;=&nbsp;vSalesOrgCodeB&nbsp;)&nbsp;<b>THEN</b>&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>SET</em>&nbsp;vReturnFlag&nbsp;=&nbsp;1;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>END</em>&nbsp;<b>IF</b>;<br />&nbsp;&nbsp;&nbsp;<em>END</em>&nbsp;<b>IF</b>;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;<b>RETURN</b>&nbsp;&nbsp;vReturnFlag;<br />&nbsp;&nbsp;<br /><em>END</em><br />@<br /><br />CALL&nbsp;DTOL.G_FN_EXEC_GRP(<s>'EBIZ1'</s>,&nbsp;<s>'F_QT_CAN_CROSS_BOR'</s>,&nbsp;<s>'public'</s>)<br />@<br />
    </div> 
  </body>
</html>
